# -*- coding: utf-8 -*-
# @Software :   PyCharm
# @File     :   forms.py
# @Author   :   zhaolie
# @Contact  :   zhaolie1989@gmail.com
# @Time     :   2019/11/17 11:55 上午
# @Desc     :   None      

# here put the import lib
from django import forms
from captcha.fields import CaptchaField
from .models import UserProfile


class RigisterForm(forms.Form):
    email = forms.EmailField(required=True)
    password = forms.CharField(required=True, min_length=2)
    captcha = CaptchaField(error_messages={'invalid': '验证码错误'})


class ForgetPwdForm(forms.Form):
    email = forms.EmailField(required=True)
    captcha = CaptchaField(error_messages={'invalid': '验证码错误'})


class LoginForm(forms.Form):
    username = forms.CharField(required=True)
    password = forms.CharField(required=True, min_length=2)


class ModifyPwdForm(forms.Form):
    password1 = forms.CharField(required=True, min_length=2)
    password2 = forms.CharField(required=True, min_length=2)


class UploadImageForm(forms.ModelForm):
    class Meta:
        model = UserProfile
        fields = ['image']
